package boot.spring.type.topic.contrller;

import boot.spring.po.Mail;
import boot.spring.po.TopicMail;
import boot.spring.service.impl.ProducerImpl;
import boot.spring.service.impl.PublisherImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TopicContrller {
    @Autowired
    PublisherImpl publisher;


    //模式
    @PostMapping("/topic")
    @ResponseBody
    public void topic(TopicMail mail){
        Mail m=new Mail(mail.getMailId(),mail.getCountry(),mail.getWeight());
        publisher.sendtopicMail(m, mail.getRoutingkey());
    }

}
